import request from '../utils/request';

export const fetchData = query => {
    return request({
        url: './table.json',
        method: 'get',
        params: query
    });
};


export const addConfig = data => {
    return request({
        url:"/api/page-config",
        method:'post',
        data:data
    })
}


export const batchItem = data => {
    return request({
        url:"/api/page-config-item/batch",
        method:"post",
        data:data
    })
}



export const getList = query => {
    return request({
        url:"/api/page-config",
        method:'get',
        params:query
    })
}


export const getPageDropdown = () =>
  request({ url: "/api/nfc/dropdown", method: "get" });

export const bindNfc = data =>
  request({ url: "/api/nfc/bind", method: "post", data });

export const unbindNfc = data =>
  request({ url: "/api/nfc/bind", method: "delete", data });

export const getNfcList = () =>
  request({ url: "/api/nfc/list", method: "get" });

export const getPageByNfc = nfcId =>
  request({ url: `/api/nfc/page/${nfcId}`, method: "get" });



// export const preView = 

export const getVoicePage = (current = 1, size = 10) =>
  request({ url: "/api/voice/page", method: "get", params: { current, size } });

export const getVoiceDropdown = () =>
  request({ url: "/api/voice/dropdown", method: "get" });

export const addVoice = data =>
  request({ url: "/api/voice", method: "post", data });

export const updateVoice = data =>
  request({ url: "/api/voice", method: "put", data });

export const deleteVoice = id =>
  request({ method: "delete", url: `/api/voice/${id}` });

export const setDefaultVoice = id =>
  request({ method: "post", url: `/api/voice/default/${id}` });

export const ttsAuto = data =>
  request({ url: "/api/voice/tts", method: "post", data });



export const generate = data => request({url:"/api/page-config/generate",method:'post',data})
